//
// Created by Administrator on 2023/8/2.
//
#include <iostream>
#include <vector>
#include <unordered_set>

using namespace std;

class Solution {
public:
    int findFinalValue(vector<int> &nums, int original) {
        // 哈希表
        unordered_set<int> s(nums.begin(), nums.end());
        while (s.count(original)) {
            original *= 2;
        }
        return original;
    }
};

int main() {
    Solution solution;
    vector<int> nums = {5, 3, 6, 1, 12};
    int original = 3;
    cout << solution.findFinalValue(nums, original) << endl;
    return 0;

}